package com.om.calculator;

import java.util.Stack;

public class RpnCalculator {
    Stack<Integer> values = new Stack<Integer>();
    
    public void enter(int value) {
        values.push(value);
    }

    public void add() {
        int rightOperand = pop();
        int leftOperand = pop();
        int sum = leftOperand + rightOperand;
        values.push(sum);
    }

    private int pop() {
        if(values.isEmpty()) {
            return 0;
        }
        return values.pop();
    }
    
    public int top() {
        return values.peek();
    }

    public void minus() {
    }

}
